package tech.aistar.day13.basedao;

import tech.aistar.day10.Book;
import tech.aistar.day13.basedao.impl.BookDaoImpl;
import tech.aistar.day13.basedao.impl.StudentDaoImpl;

import java.util.List;

/**
 * 本类用来演示:
 *
 * @author: success
 * @date: 2021/3/24 3:31 下午
 */
public class TestDemo {
    public static void main(String[] args) {
        //1. 测试Book
//        Book b1 = new Book(3,"1003","红楼梦",100.0d);
//        //2. 创建接口对象
//        IBookDao bookDao = new BookDaoImpl();
//        bookDao.save(b1,"src/tech/aistar/day13/basedao/books.txt");
//
//        List<Book> bookList = bookDao.findAll("src/tech/aistar/day13/basedao/books.txt");
//        for (Book book : bookList) {
//            System.out.println(book);
//        }

        Student s = new Student(2,"tom");
        IStudentDao dao = new StudentDaoImpl();
        dao.save(s,"src/tech/aistar/day13/basedao/students.txt");

        List<Student> students = dao.findAll("src/tech/aistar/day13/basedao/students.txt");
        for (Student student : students) {
            System.out.println(student);
        }
    }
}
